<template>
	<z-paging ref="paging" bgColor="transparent" class="content" empty-view-text="无搜索结果，换个词试试吧~" v-model="data" @query="queryList">
		<template #top>
			<view class="top-box" style="background-color: #fff;">
				<view class="box ">
					<up-search :show-action="true" v-model="keyword" @blur="onSearch" bgColor="#F7F8FA" placeholder="关键词搜索" actionText="搜索" :animation="true"></up-search>
				</view>
			</view>
		</template>
		<view class="box">
			<my-good-list :list="data"></my-good-list>
		</view>
	</z-paging>
</template>

<script setup>
	import {ref} from "vue"
	import {onLoad} from "@dcloudio/uni-app"
	import {getProducts} from "@/api/products.js"
	const keyword=ref('')
	const paging=ref(null)
	const data=ref([])
	const onSearch=()=>{
		paging.value.reload()
	}
	const queryList=async (pageNo, pageSize)=>{
		//请求接口数据
		let d=[];
		if(keyword.value!=''){
			let res=await getProducts({params:{
					keyword:keyword.value,
					limit:pageSize,
					page:pageNo
				}})
			d=res.data	
		}
		paging.value.complete(d);
	}
</script>

<style>

</style>
